{ config, pkgs, ... }:

{
  i18n.defaultLocale = "en_US.UTF-8";
  i18n.inputMethod = {
    enabled = "fcitx5";
    fcitx5.addons = with pkgs;[
      fcitx5-chinese-addons
      fcitx5-configtool
      fcitx5-gtk
    ];
  };
    environment.sessionVariables = {
    # copy from  https://github.com/nix-community/home-manager/blob/master/modules/i18n/input-method/fcitx5.nix
    GLFW_IM_MODULE = "fcitx";
    GTK_IM_MODULE = "fcitx";
    QT_IM_MODULE = "fcitx";
    XMODIFIERS = "@im=fcitx";
    INPUT_METHOD = "fcitx";
    IMSETTINGS_MODULE = "fcitx";
  };

  services.printing.enable = true;

  fonts = {
    packages = with pkgs; [
      # icon fonts
      material-design-icons
      # normal fonts
      noto-fonts
      noto-fonts-emoji
      noto-fonts-cjk-sans
      noto-fonts-cjk-serif
      source-han-sans
      source-han-serif
      # sarasa-gothic  #更纱黑体
      source-code-pro
      hack-font
      jetbrains-mono
      # nerdfonts
      (nerdfonts.override { fonts = [ "FiraCode" "JetBrainsMono" ]; })
    ];

    # use fonts specified by user rather than default ones
    enableDefaultPackages = false;


    # the reason there's Noto Color Emoji everywhere is to override DejaVu's
    # B&W emojis that would sometimes show instead of some Color emojis
    fontconfig.defaultFonts = {
      serif = [
        "Source Han Serif SC"
        "Noto Serif CJK SC"
        "DejaVu Serif"
        "Noto Serif"
        ];
      sansSerif = [
        "Source Han Sans SC"
        "Noto Sans CJK SC"
        "DejaVu Sans"
        "Noto Sans"
        ];
      monospace = [
        "FiraCode Nerd Font Mono"
        "JetBrainsMono Nerd Font"
        "Noto Color Emoji"
        ];
      emoji = [ "Noto Color Emoji" ];
    };
  };
}